package com.gec.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gec.model.system.ITripHotel;
import com.gec.model.system.ITripImage;
import com.gec.system.mapper.ITripImageMapper;
import com.gec.system.service.ITripImageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 图片表 服务实现类
 * </p>
 *
 * @author dafei
 * @since 2024-01-25
 */
@Service
public class ITripImageServiceImpl extends ServiceImpl<ITripImageMapper, ITripImage> implements ITripImageService {

    @Override
    public Long getId(int type, Long targetId) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("targetId",targetId);//相当于where name=1
        wrapper.eq("type",type);//相当于where name=1
        List<ITripImage> list = baseMapper.selectList(wrapper);
        return list.size()==0 ?null :list.get(0).getId();
    }
}
